# $1 : your environment name;  $2 : python version , such as 3.5, 3.6
# $3 : the directory where your requirements.txt locate, for example /home/iptv/myDir/, the directory must end up with "/" symbol.

# Usage:  /home/iptv/lmqfile/DASRGNNv4/installCondaEnv.sh myDefinedEnv 3.6 /home/iptv/lmqfile/DASRGNNv4/
# so $1 = myDefinedEnv
# $2 = 3.6
# $3 = /home/iptv/lmqfile/DASRGNNv4/
echo "y" | conda remove -n $1  --all
echo "y" | conda create -n $1 python=$2
echo "==========Create $1 environment finished!!!=========="
# shellcheck disable=SC2154
echo "============================== conda env list ============="
conda env list
echo "===========Begining installing packages=============="
source activate $1

echo "========================BEGIN========================="
date
ls /home/iptv/lmqfile/DASRGNNv4/*whl |xargs pip install
pip install -r "$3"requirements.txt
echo "========================End=============================="
echo "========================$1 environment has finished installing packages======="
